package com.jintoufs.service.shop.impl;

import com.jintoufs.dao.shop.ShopMapper;
import com.jintoufs.domain.shop.Shop;
import com.jintoufs.service.shop.ShopService;
import com.jintoufs.util.valid.ValidUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class ShopServiceImpl implements ShopService {
    @Resource
    private ShopMapper shopMapper;
    @Override
    public Shop save(Shop shop,String id) {
        if (!ValidUtil.isEmpty(id)){
            shop.setId(id);
            shopMapper.insertSelective(shop);
        }else{
            shopMapper.updateByPrimaryKey(shop);
        }
        return shop;
    }

    @Override
    public List<Shop> selectByParam(Map<String, Object> param) {
        return shopMapper.selectByParam(param);
    }

    @Override
    public Shop selectById(String id) {
        return shopMapper.selectByPrimaryKey(id);
    }

    @Override
    public Shop selectByValueId(String id) {
        return shopMapper.selectByValueId(id);
    }
}
